#ifndef __RADAR_H__
#define __RADAR_H__

#include <stdio.h>
#include <stdbool.h>

#define DETECT_DATA_REPORT_MAX 16

typedef struct{
    uint32_t    head;
    uint8_t     len_l;
    uint8_t     len_h;
    uint8_t     cmd_l;
    uint8_t     cmd_h;
    uint16_t    ack;
    uint8_t     data[0];
}cmd_frame_t;

typedef struct{
    uint8_t     result;
    uint8_t     distance_l;
    uint8_t     distance_h;
    uint8_t     data[0];
}detect_frame_t;


typedef struct {
    uint8_t body_status;    //人体状态
    uint8_t body_movement;  //活跃度
    uint8_t respiratory;    //呼吸率
    uint8_t flow_state;     //心流状态
    uint8_t posture_state;  //姿态状态
    uint8_t activity_freq;  //过去一分钟活动频繁度
    uint8_t body_distance;       //身体位置距离
    uint8_t body_angle;     //身体位置角度
    uint8_t head_pos;       //头位置距离
    uint8_t head_angle;     //头位置角度
    uint8_t hand_pos;       //手位置距离
    uint8_t hand_angle;     //手位置角度 
    uint8_t heart_rate;     //心率
    uint8_t position_interval;     //心率
    uint8_t flow_state_level;
    uint8_t present_state;
}human_state_t;

extern human_state_t human_state;
extern human_state_t human_state_ex;

typedef struct {
    uint16_t    mild;
    uint16_t    moderate;
    uint16_t    severe;
    uint16_t    lighting;
    uint16_t    present;
    uint16_t    now;
    uint16_t    single;
    uint16_t    last;
    uint16_t    sum;
}learning_duration_t;
extern learning_duration_t learning_duration;

typedef struct {
    uint32_t ss_time;
    uint32_t se_time;
    uint16_t study_efficiency;
    uint16_t concentration;
    uint16_t learning_continuity;
    uint16_t posture_management;
    uint16_t eva;
}report_attr_t;
extern report_attr_t report_attr;

extern bool inseat_state;
extern uint8_t present_state;
extern bool radar60_init_flag;

extern void radar_data_parse(char *buf, uint16_t length);
extern void radar_set_en(void);
extern void radar_init(void);

#endif